rezurl=/url\(([\s|\S]+)\)/;
base_url='%(site_root)s';
cmtime ='%(cmtime)s';
version = '%(version)s';
zurl = function(u){
        if(rezurl.test(u)){
            real=rezurl.exec(u)[1];
            n='url('+base_url+real+')';
            return u.replace(rezurl,n);
        }
        else{
            return base_url+u;
        }
};



zrequire = function(requires,func){
	rs=requires;
	l=function(){
		url = rs.shift();
		if(url == undefined ){
			return func();
		}else{
			$.getScript(url,l);
		}
		
	}
	first = rs.shift();
	if(first== undefined ){
		return func();
	}else{
		$.getScript(first,l);
	}	
}



 sortContainer=   
	 {   
	     compare: function(v1, v2)   
	     {   if(v1 == undefined && v2 ==undefined)
	    	 	return 0;
	     	if(v1 == undefined )
	     		return 1;
	     	if(v2 == undefined)
	     		return -1;
	    	 	
	         if (v1['id']==v2['id'])   
	             return 0;   
	         else if (v1['bed']<v2['bed'])   
	             return -1;   
	         else  
	             return 1;   
	     },   
	   
	     swap: function(i1, i2)   
	     {  
	    	
	     } 
	        
	    
	 }   
	   
	 function quickSort(a, container)   
	 {   
	     if (a==null)   
	         return;   
	     var length=a.length;   
	     if (length<2)   
	         return;   
	     function internalQuickSort(lowIndex, highIndex, a, container)   
	     {   
	         if (lowIndex<highIndex)   
	         {   
	             var pos=internalPartition(lowIndex, highIndex, a, container);   
	             internalQuickSort(lowIndex, pos-1, a, container);   
	             internalQuickSort(pos+1, highIndex, a, container);   
	         }   
	     }   
	     function internalPartition(lowIndex, highIndex, a, container)   
	     {   
	         var pivot=a[lowIndex];   
	         var lowI=lowIndex;   
	         var highI=highIndex;   
	         while (true)   
	         {   
	             do {lowI++;} while (container.compare(a[lowI], pivot)<0);   
	             while (container.compare(a[highI], pivot)>0) {highI--;}   
	             if (lowI>=highI) break;   
	             var tmp=a[lowI];   
	             a[lowI]=a[highI];   
	             a[highI]=tmp;   
	             container.swap(lowI, highI);   
	             if (container.debug) container.debug("* "+lowI+"("+a[highI]+") -&gt; "+highI+"("+a[lowI]+") ["+a.join(",")+"]");   
	         }   
	         if (lowIndex!=highI)   
	         {   
	             a[lowIndex]=a[highI];   
             a[highI]=pivot;   
	             container.swap(lowIndex, highI);   
	             if (container.debug) container.debug(lowIndex+"("+a[highI]+") -&gt; "+highI+"("+a[lowIndex]+") ["+a.join(",")+"]");   
	         }   
	         return highI;   
	     }   
	     if (container.debug) container.debug("["+a.join(",")+"]");   
	     internalQuickSort(0, length-1, a, container);   
	     if (container.debug) container.debug("["+a.join(",")+"]");   
	 } 